package com.iflytek.hive.need5;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

public class QuatGroupingComparator extends WritableComparator {
    protected QuatGroupingComparator(){
        super(QuatOrderBean.class,true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        QuatOrderBean aBean = (QuatOrderBean) a;
        QuatOrderBean bBean = (QuatOrderBean) b;
        String first = aBean.getDate().substring(0,4)+aBean.getQuat();
        String secound = bBean.getDate().substring(0,4)+bBean.getQuat();
        return first.compareTo(secound);
    }
}
